﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

public class SystemPanel : BasePanel {
    private CanvasGroup canvasGroup;

    void Start()
    {
        if (canvasGroup == null) canvasGroup = GetComponent<CanvasGroup>();
    }

    public override void OnEnter()
    {
        if (canvasGroup == null) { canvasGroup = GetComponent<CanvasGroup>(); }
        canvasGroup.alpha = 1;
        canvasGroup.blocksRaycasts = true;
        Vector3 temp =transform.localPosition;
        temp.x=600;
        transform.localPosition=temp;
        transform.DOLocalMoveX(0,.5f);
        
    }
    /// <summary>
    /// 处理页面的关闭
    /// </summary>
    public override void OnExit()
    {
        
        canvasGroup.blocksRaycasts = false;
        transform.DOLocalMoveX(600,.5f).OnComplete(()=>canvasGroup.alpha=0);

    }
    public void OnClosePanel()
    {
        UIManager.Instance.PopPanel();


    }

}
